package cn.iocoder.yudao.module.shop.dal.mysql.crosstenant;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.shop.dal.dataobject.crosstenant.ShopCrossTenantDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.shop.controller.admin.crosstenant.vo.*;

/**
 * 跨店铺 Mapper
 *
 * @author 曹建伟
 */
@Mapper
public interface ShopCrossTenantMapper extends BaseMapperX<ShopCrossTenantDO> {

    default PageResult<ShopCrossTenantDO> selectPage(ShopCrossTenantPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopCrossTenantDO>()
                .eqIfPresent(ShopCrossTenantDO::getCrossTenantId, reqVO.getCrossTenantId())
                .likeIfPresent(ShopCrossTenantDO::getTenantName, reqVO.getTenantName())
                .betweenIfPresent(ShopCrossTenantDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopCrossTenantDO::getId));
    }

    default List<ShopCrossTenantDO> selectList(ShopCrossTenantExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ShopCrossTenantDO>()
                .eqIfPresent(ShopCrossTenantDO::getCrossTenantId, reqVO.getCrossTenantId())
                .likeIfPresent(ShopCrossTenantDO::getTenantName, reqVO.getTenantName())
                .betweenIfPresent(ShopCrossTenantDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopCrossTenantDO::getId));
    }

}
